{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" id="keyword" class="layui-input search" name="keyword" value="" placeholder="昵称|备注|电话"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" id="start" class="layui-input search" name="start" onclick="wk.lay_date(this);" readonly  placeholder="注册时间开始"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" id="end" class="layui-input search" name="end" onclick="wk.lay_date(this);" readonly  placeholder="注册时间结束"/>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <select name="user_status" class="layui-input">
                                <option value="">不限状态</option>
                                <option value="1">正常</option>
                                <option value="2">冻结</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <select name="user_type" class="layui-input">
                                <option value="">不限案例类型</option>
                                <option value="1">普通用户</option>
                                <option value="2">合作商</option>
                                <option value="3">业务员</option>
                                <option value="4">内部员工</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <select name="user_my" class="layui-input">
                                <option value="">不限权限</option>
                                <option value="1">只能看已完成案例</option>
                                <option value="2">能看所有案例</option>
                            </select>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button class="btn btn-primary" type="button" onclick="wk.layer_show('新增客户', '{:url('newAdd3')}')">
                            <i class="fa fa-plus"></i> 新增客户
                        </button>
                        <!--<button class="btn btn-primary" type="button" onclick="wk.layer_show('新增设计师', '{:url('newAdd2')}')">-->
                            <!--<i class="fa fa-plus"></i> 新增设计师-->
                        <!--</button>-->
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--操作模板-->
                    <script type="text/html" id="user_status">
                    {{# if(d.user_status == 1){ }}
                    正常
                    {{# } }}
                    {{# if(d.user_status == 2){ }}
                    已冻结
                    {{# } }}
                    </script>
                    <script type="text/html" id="user_my">
                    {{# if(d.user_my == 1){ }}
                    已完成的
                    {{# } }}
                    {{# if(d.user_my == 2){ }}
                    所有的
                    {{# } }}
                    </script>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.user_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                    </script>
                    <script type="text/html" id="opeBar">
                        {{# if(d.user_status == 1){ }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('down')}','确定冻结吗?')" class="btn btn-primary btn-xs m-r-xs" title="冻结">冻结</a>
                        {{# } }}
                        {{# if(d.user_status == 2){ }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.user_id}}','{:url('up')}','确定启用吗?')" class="btn btn-warning btn-xs m-r-xs" title="启用">启用</a>
                        {{# } }}

                        {{# if(d.user_d_type == 2){ }}
                        <a href="javascript:;" onclick="wk.layer_show('编辑', '{:url('memberDetail2')}?user_id={{d.user_id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑">编辑</a>
                        <a href="javascript:;" onclick="wk.layer_show('文件设置', '{:url('newBanner')}?user_id={{d.user_id}}')" class="btn btn-primary btn-xs m-r-xs" title="文件设置">文件设置</a>
                        {{# } else{ }}
                        <a href="javascript:;" onclick="wk.layer_show('编辑', '{:url('memberDetail')}?user_id={{d.user_id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑">编辑</a>
                        {{# } }}

                        <a href="javascript:;" onclick="wk.layer_show('案例相关权限设置', '{:url('authCase')}?user_id={{d.user_id}}')" class="btn btn-warning btn-xs m-r-xs" title="案例相关权限设置">权限设置</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Memberother/three")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 300]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left'}
                  {type:'numbers', width: 60, title: '序号'}
                , {field: 'user_id', width: 60, title: 'ID', align: 'center'}
                , {field: 'user_username', width: 130, title: '昵称', align: 'center'}
                , {field: 'user_image', width: 90, title: '头像', align: 'center', templet: '#imgTpl'}
                , {field: 'user_phone', width: 120, title: '手机号码', align: 'center'}
                , {field: 'user_type_name', width: '', title: '用户案例类型', align: 'center'}
                , {field: 'user_my', width: '', title: '案例权限', align: 'center',toolbar: '#user_my'}
                , {field: 'user_time', width: '', title: '注册时间', sort: true, align: 'center'}
                , {field: 'user_logintime', width: '', title: '最新访问时间', sort: true, align: 'center'}
                , {field: 'user_status', width: 90, title: '用户状态', align: 'center',toolbar: '#user_status'}
                , {fixed: 'right', width:280, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        //批量操作
        var $ = layui.$, active = {
            //批量导出订单
            excelAll:function () {
                wk.excelAll(getIds(),$('.layui-input').serialize(),"{:url('outExcel')}");
            },
            //全部导出
            excelAllNoSelect:function () {
                wk.excelAllNoSelect($('#allidsForOut').val(),$('.layui-input').serialize(),"{:url('outExcel')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['user_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>